<title>我的文章</title>

<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <a lay-href="">主页</a>
        <a><cite>文章管理</cite></a>
        <a><cite>我的文章</cite></a>
    </div>
</div>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">文章标题</label>
                    <div class="layui-input-inline">
                        <input autocomplete="off" class="layui-input search-art" name="title" placeholder="请输入"
                               type="text">
                    </div>
                    <label class="layui-form-label">文章内容</label>
                    <div class="layui-input-inline">
                        <input autocomplete="off" class="layui-input search-art" name="text" placeholder="请输入"
                               type="text">
                    </div>
                    <label class="layui-form-label">文章类型</label>
                    <div class="layui-input-inline">
                        <select name="status" id="status" lay-verify="" class="search-art-type">
                            <option value="100">所有</option>
                            <option value="90">已发布</option>
                            <option value="00">草稿</option>
                        </select>
                    </div>
                    <br>
                    <div>
                        <label class="layui-form-label">日期范围</label>
                        <div class="layui-inline" id="publish-range">
                            <div class="layui-input-inline">
                                <input type="text" autocomplete="off" id="publish-startDate" class="layui-input" name="publishDateStart" placeholder="开始日期">
                            </div>
                            <div class="layui-form-mid">-</div>
                            <div class="layui-input-inline">
                                <input type="text" autocomplete="off" id="publish-endDate" class="layui-input" name="publishDateEnd" placeholder="结束日期">
                            </div>
                        </div>

                    </div>


                </div>
                <div style="float: right">
                    <button class="layui-btn layuiadmin-btn-art search-btn" data-type="reload" lay-filter="art-search"
                            lay-submit>
                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                    </button>
                </div>
            </div>
        </div>
        <div class="layui-card-body">
            <div style="padding-bottom: 10px;">
                <button class="layui-btn layuiadmin-btn-art layui-btn-danger" data-type="batchdel">移入回收站</button>
            </div>
            <table id="article-table" lay-filter="content-art"></table>
            <script id="table-content-art" type="text/html">
                <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="quickEdit"><i
                        class="layui-icon layui-icon-reply-fill"></i>快速编辑</a>
                <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"
                   lay-href="/article/edit/id={{d.oid}}"><i
                        class="layui-icon layui-icon-form"></i>编辑</a>
                <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i
                        class="layui-icon layui-icon-delete"></i>移入回收站</a>
                {{#  if(d.status === '00'){ }}
                <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="publish"><i
                        class="layui-icon layui-icon-release"></i>发布</a>
                {{#  } }}
            </script>
        </div>
    </div>
</div>

<script>
    layui.use('articleList', layui.factory('articleList')).use(['admin', 'articleList', 'form', 'table'], function () {
        var form = layui.form
            , $ = layui.jquery
            , laydate = layui.laydate
        ;
        var select = document.getElementById("status");
        var mode = layui.router().search.mode;
        var keywords = layui.router().search.keywords;
        var status = "100";
        if ('PUBLISHED' === mode) {
            status = "90"
        } else if ('DRAFT' === mode) {
            status = "00"
        }
        if (select && mode) {
            select.value = status;
            $(".search-btn").trigger("click");
        }
        if (keywords) {
            $('input[name=title]').val(keywords);
            $(".search-btn").trigger("click");
        }

        //日期范围
        laydate.render({
            elem: '#publish-range'
            //设置开始日期、日期日期的 input 选择器
            //数组格式为 2.6.6 开始新增，之前版本直接配置 true 或任意分割字符即可
            ,range: ['#publish-startDate', '#publish-endDate']
        });

        form.render()
    })
</script>